<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="../static/easyui/jedate.min.js"></script>
<script type="text/javascript" src="../static/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../static/easyui/jquery.easyui.min.js"></script><link rel="stylesheet" href="../static/easyui/themes/icon.css">
<link rel="stylesheet" href="../static/easyui/themes/metro-orange/easyui.css">
<link rel="stylesheet" href="../static/easyui/themes/metro-red/window.css">
<link rel="stylesheet" href="../static/ttt/css/TrainingProject.css?<%=Math.random()%>">

<style type="text/css">

</style>
</head>
<body>
<script type="text/javascript">
function poj_table(){
	$('#TrainingProjectable').datagrid({    
		 url:'TrainingProjectables', //数据源地址
	 	 columns:[[    
	 	  {field:'POJSID',fixed:false,width:100,title:'项目id',hidden:true,align:"center"},   
	      {field:'PLANNAME',fixed:false,width:100,title:'项目名称',align:"center"},    
	      {field:'EMPNAME',fixed:false,width:100,title:'创建人',align:"center"},
	      {field:'PLANDD',fixed:false,width:100,title:'培训地点',align:"center"},
	      {field:'PLANTS',fixed:false,width:100,title:'培训天数',align:"center"} ,
	      {field:'PLANNIND',fixed:false,width:100,title:'开始时间',align:'center',
	    	   formatter : function(value){
	        		var d = new Date(value);
	        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
	        		return times;
	        	}   
	       } ,
	       {field:'PLANMAXD',fixed:false,width:100,title:'结束时间',align:'center',
	    	   formatter : function(value){
	        		var d = new Date(value);
	        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
	        		return times;
	        	}   
	       } ,
	      {field:'POJSTIME',fixed:false,width:100,title:'创建日期',
	    	  formatter : function(value){
	        		var d = new Date(value);
	        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
	        		return times;
	        	}   
	      ,align:"center"}    
	  ]],
	  pagination:true,
	  pageNumber:1,
	  pageSize:5,
	  pageList:[5,10,15] 
	}); 
}
$(function(){
	poj_table();
 	$("#addTrainingProject").click(function(){
 		$.ajax({
			type:"post",
			url:'remosession', //数据源地址
			success: function(data){
				var text='新增培训项目';
				var url="ttt/add-training-project";
				adds(text,url)
			}
			
 		})
		
	}) 
	//双击事件
	 $("#TrainingProjectable").datagrid({
         //双击事件
         onDblClickRow: function (index,row) {
						 $("#pjos_mingxi").window("open");
						 $("#pjos_mingxi_table").datagrid({
							 url:"pojs_yuangong",
							 queryParams:{
								 pojsid:row["POJSID"] 
							 },
							 columns:[[    
							 	 {field:'EMPNAME',fixed:false,width:100,title:'培训员工',align:"center"}, 
							 	 {field:'EMPCARD',fixed:false,width:100,title:'员工证件号',align:"center"},
							 	 {field:'PLANNAME',fixed:false,width:100,title:'培训计划',align:"center"}
							  ]],
							  pagination:true,
							  pageNumber:1,
							  pageSize:5,
							  pageList:[5,10,15] 
						 })
						 $("#pjos_mingxikecheng_table").datagrid({
							 url:"pojs_kecheng",
							 queryParams:{
								 pojsid:row["POJSID"] 
							 },
							 columns:[[    
							 	 {field:'RUSNAME',fixed:false,width:100,title:'培训课程',align:"center"}, 
							 	 {field:'RUSMIAOS',fixed:false,width:100,title:'课程备注',align:"center"},
							 	 {field:'EMPNAME',fixed:false,width:100,title:'培训讲师',align:"center"}
							  ]],
							  pagination:true,
							  pageNumber:1,
							  pageSize:5,
							  pageList:[5,10,15] 
						 })
         } 
     })
     //根据项目名称查询
     $("#selectTrainingProject").click(function(){
    	 var text=$("#TrainingProjectname").val();
    	 if(text!=""){
    			$('#TrainingProjectable').datagrid({    
    				 url:'TrainingProjectables_name', //数据源地址
    				 queryParams:{
    					 text:text
    				 },
    			 	 columns:[[    
    			 	  {field:'POJSID',fixed:false,width:100,title:'项目id',hidden:true,align:"center"},   
    			      {field:'PLANNAME',fixed:false,width:100,title:'项目名称',align:"center"},    
    			      {field:'EMPNAME',fixed:false,width:100,title:'创建人',align:"center"},
    			      {field:'PLANDD',fixed:false,width:100,title:'培训地点',align:"center"},
    			      {field:'PLANTS',fixed:false,width:100,title:'培训天数',align:"center"} ,
    			      {field:'PLANNIND',fixed:false,width:100,title:'开始时间',align:'center',
    			    	   formatter : function(value){
    			        		var d = new Date(value);
    			        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
    			        		return times;
    			        	}   
    			       } ,
    			       {field:'PLANMAXD',fixed:false,width:100,title:'结束时间',align:'center',
    			    	   formatter : function(value){
    			        		var d = new Date(value);
    			        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
    			        		return times;
    			        	}   
    			       } ,
    			      {field:'POJSTIME',fixed:false,width:100,title:'创建日期',
    			    	  formatter : function(value){
    			        		var d = new Date(value);
    			        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
    			        		return times;
    			        	}   
    			      ,align:"center"}    
    			  ]]
    			}); 
    	 }else if(text==""){
    		 poj_table(); 
    	 }
     })

})
	//在每个操作列里面添加编辑，查看，明细，删除
/* 	function operate_formatter(value, row, index) {
		return "<span>明细</span>";
	}  */
</script>
	    <div id="pjos_mingxi" class="easyui-window" title="培训项目明细" style="width:720px;height:600px"
		    		data-options="modal:true,closed:true,minimizable:false,maximizable:false,collapsible:false,resizable: false,draggable:false">
			<div style="width:700px;height:202px;margin:0px auto;margin-top:20px;">
				<table id="pjos_mingxi_table" class="easyui-datagrid" style="width:700px;height:200px;" data-options="fitColumns:true">
					
				</table> 
			</div>
			<div style="width:700px;height:302px;margin:0px auto;margin-top:20px;">
				<table id="pjos_mingxikecheng_table" class="easyui-datagrid" style="width:700px;height:300px;" data-options="fitColumns:true">
					
				</table> 
			</div>
		 </div>
		<div id="TrainingProject_head">
			<span class="fontstyle">培训项目名称：<span><input  type="text" id="TrainingProjectname" class="TrainingPlanName"></span></span>
			<button id="selectTrainingProject" style="margin-right:15px;">查询</button>
			<button id="addTrainingProject">新增</button>
		</div>
		<div id="TrainingProject_table">
			<table id="TrainingProjectable" class="easyui-datagrid" style="width:calc(100% - 10px);height:470px;" data-options="fitColumns:true">
					
			</table> 
		</div>
	</body>
</html>